<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" xmlns:range="http://www.w3.org/1999/xhtml"
      th:replace="layout/master(title='学生信息处理系统')">
<th:block th:fragment="css">
    <link rel="stylesheet" href="/plugins/bootstraptable/bootstrap-table.min.css">
</th:block>
<div th:fragment="content" class="container-fluid">
    <h1 style="position: relative; left: 650px;">学生信息处理系统</h1>
    <button id="allStudent" type="button" class="btn btn-default btn-lg">
        显示所有学生信息
    </button>
    <button type="button" class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModal" onclick="preAdd();">
        新增学生
    </button>
    <button type="button" class="btn btn-primary btn-lg" data-toggle="modal" data-target="#searchModal">
        查询学生
    </button>
    <br><br>
    <!--学生信息模态框-->
    <div class="modal fade" tabindex="-1" role="dialog" id="myModal">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                    <h4 class="modal-title">学生信息</h4>
                </div>
                <div class="modal-body">
                    <form id="studentForm">
                        <div class="form-group" id="editId" style="display: none;">
                            <label for="id">编号</label>
                            <input type="text" class="form-control" id="id" name="id" placeholder="编号" readonly>
                        </div>
                        <div class="form-group">
                            <label for="no">学号</label>
                            <input type="text" class="form-control" id="no" name="no" placeholder="学号" required
                                   minlength="10" maxlength="10">
                        </div>
                        <div class="form-group">
                            <label for="name">姓名</label>
                            <input type="text" class="form-control" id="name" name="name" placeholder="姓名" required
                                   minlength="2" maxlength="10">
                        </div>
                        <div class="form-group">
                            <label for="sex">性别</label>
                            <select class="form-control" id="sex" name="sex">
                                <option value="1">男</option>
                                <option value="2">女</option>
                            </select>
                        </div>
                        <div class="form-group">
                            <label for="cno">所选课程号</label>
                            <select class="form-control" id="cno" name="cno">
                                <option value="2001">数据库</option>
                                <option value="2002">高数</option>
                                <option value="2003">操作系统</option>
                                <option value="2004">计算机网络</option>
                                <option value="2005">Web开发</option>
                                <option value="2006">数据结构</option>
                            </select>
                        </div>
                        <div class="form-group">
                            <label for="score">成绩</label>
                            <input type="text" class="form-control" id="score" name="score" placeholder="成绩" required
                                   range:[0,100]>
                        </div>
                        <div class="modal-footer">
                            <button type="submit" class="btn btn-primary" id="saveBtn">保存</button>
                        </div>
                    </form> <!--表单结束-->
                </div>
            </div><!-- /.modal-content -->
        </div><!-- /.modal-dialog -->
    </div><!-- /.modal -->
    <!-- 查询模态框 -->
    <div class="modal fade" id="searchModal" tabindex="-1" role="dialog" aria-labelledby="searchModalLabel" aria-hidden="true">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <h5 class="modal-title" id="searchModalLabel">查询相关学生信息</h5>
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                        <span aria-hidden="true">&times;</span>
                    </button>
                </div>
                <div class="modal-body">
                    <div class="form-group">
                        <label for="searchBy">选择查询方式：</label>
                        <select class="form-control" id="searchBy">
                            <option value="id">ID</option>
                            <option value="no">学号</option>
                            <option value="name">姓名</option>
                            <option value="cno">课程号</option>
                        </select>
                    </div>
                    <div class="form-group">
                        <label for="searchInput">输入查询关键词：</label>
                        <input type="text" class="form-control" id="searchInput" placeholder="请输入查询关键词">
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-secondary" data-dismiss="modal">关闭</button>
                    <button type="button" class="btn btn-primary" onclick="searchStudent()">查询</button>
                </div>
            </div>
        </div>
    </div>
    <table class="table table-hover" id="studentTb"></table>
</div>
<div th:fragment="scripts">
    <script src="/plugins/bootstraptable/bootstrap-table.min.js"></script>
    <script src="/plugins/bootstraptable/locale/bootstrap-table-zh-CN.min.js"></script>
    <script src="/plugins/jqvalidate/jquery.validate.min.js"></script>
    <script src="/plugins/jqvalidate/localization/messages_zh.min.js"></script>
    <script type="text/javascript" src="/pagejs/student/newlist.js"></script>
</div>
</html>